[PULP-1254] Serve Python content form a repository version#1336
[PULP-1254] Serve Python content form a repository version#1336
Conversation
0f116b6 to
96c64f6
Compare
| @distribution.command() | ||
| @apply_decorators(lookup_options + update_options + [click.option("--base-path")]) | ||
| @pass_entity_context | ||
| def update( |
There was a problem hiding this comment.
Is this needed? Originally we had to overwrite the update command because pulpcore wouldn't accept a PATCH with publication=None, repository=HREF or vice-versa so we had to break it up into two updates. I think we fixed that now and this workaround should no longer be needed.
There was a problem hiding this comment.
Updated, does it look better now? I had to move some logic to preprocess_entity and kept the first version for now.
| context_table={"python:python": PulpPythonRepositoryContext}, | ||
| help=_( | ||
| "Repository to be used for auto-distributing." | ||
| " When used with --version, this will create repository_version instead." |
There was a problem hiding this comment.
| " When used with --version, this will create repository_version instead." | |
| " When used with --version, this will select a repository version instead." |
But now with the version set it's no longer "auto-distributing". I think we should rethink the whole string.
There was a problem hiding this comment.
Yeah, I moved the changes to the --version option
There was a problem hiding this comment.
My point is the version option actually changes the interpretation of the repository option even more significantly.
| ), | ||
| repository_option, | ||
| pulp_option( | ||
| "--version", |
There was a problem hiding this comment.
What happens if you specify the version and no repository?
There was a problem hiding this comment.
repository_version is created based on the newly provided version and already existing repository (repository is then set to null). This is covered in tests.
| if "repository" not in body and "publication" in body: | ||
| body["repository"] = None | ||
|
|
||
| if self.pulp_ctx.has_plugin(PluginRequirement("python", specifier=">=3.21.0")): |
There was a problem hiding this comment.
What happens when you specify --version on pulp_python<3.21?
There was a problem hiding this comment.
CLI returns Error: {"version":["Unexpected field"]}
There was a problem hiding this comment.
Can you add a corresponding "needs_version" to the top of this method?
| body["repository_version"] = f"{repository_href}versions/{version}/" | ||
| body["repository"] = None | ||
| else: | ||
| current_entity = getattr(self, "entity", {}) |
There was a problem hiding this comment.
In fact, i think we should look specifically at the "partial" parameter here.
"partial=True" is used for http "PATCH" calls, where we can assume there is an existing entity.
"partial=False" means either "PUT" (not used by the cli) or "POST" (for create) in which case a version without a repository is invalid.
| @@ -0,0 +1 @@ | |||
| Added support for serving Python content form a repository version. | |||
There was a problem hiding this comment.
This is part of the "we don't need no publication" effort, right?
There was a problem hiding this comment.
Yeah, it is more like "we can specify the repository version directly, even without using a publication"
closes pulp#1324 Assisted by: Claude Sonnet 4
closes #1324